---
title: Lua Reference - kong.kong
layout: default
---


<header class="page-header">
  <div class="container">
    <div class="page-header-icon">
      <img src="/assets/images/icons/icn-documentation.svg" alt="Documentation" />
    </div>
    <div class="page-header-title">
      <h1>Public Lua API Reference</h1>
      <p>For plugins developers and core contributors</p>
    </div>
    {% if site.data.kong_versions.size > 1 %}
      {% include lua-reference-dropdown.html
        page=page
        site=site
      %}
    {% endif %}
  </div>
</header>

<div class="container">
  <aside class="page-navigation">
    <nav>
      <ul>
        <li>
          <a href="/{{page.kong_version}}"><h5>Back to docs</h5></a>
        </li>
        <li>
          <a href="/{{page.kong_version}}/lua-reference/"><h5>Index</h5></a>
        </li>
        <li>
          <h5>Modules</h5>
          <ul>
            <li><a href="../../modules/kong.dao.cassandra.base_dao">kong.dao.cassandra.base_dao</a></li>
            <li>kong.kong</li>
            <li><a href="../../modules/kong.plugins.basic-auth.crypto">kong.plugins.basic-auth.crypto</a></li>
            <li><a href="../../modules/kong.plugins.jwt.jwt_parser">kong.plugins.jwt.jwt_parser</a></li>
            <li><a href="../../modules/kong.plugins.log-serializers.alf">kong.plugins.log-serializers.alf</a></li>
            <li><a href="../../modules/kong.tools.io">kong.tools.io</a></li>
            <li><a href="../../modules/kong.tools.responses">kong.tools.responses</a></li>
            <li><a href="../../modules/kong.tools.timestamp">kong.tools.timestamp</a></li>
            <li><a href="../../modules/kong.tools.utils">kong.tools.utils</a></li>
          </ul>
        </li>
      </ul>
    </nav>
  </aside>

  <div class="page-content-container">
  <div class="page-content">
    <div class="content">
<h1><code>kong.kong</code></h1>
<p>Attach a hooks table to the event bus</p>
<p></p>



<h2><a href="#Kong_public_context_handlers">Kong public context handlers </a></h2>
<table class="function_list">
  <tr>
    <td class="name"><a href="#Kong.init">Kong.init ()</a></td>
    <td class="summary">Init Kong's environment in the Nginx master process.</td>
  </tr>
</table>


<h2 class="section-header "><a name="Kong_public_context_handlers">Kong public context handlers </a></h2>


<dl class="function">
  <hr />
  <dt>
    <h4><a name="Kong.init">Kong.init</a></h4>
  </dt>
  <dd>
    Init Kong's environment in the Nginx master process.
 To be called by the lua-nginx-module <code>init_by_lua</code> directive.
 Execution:
   - load the configuration from the path computed by the CLI
   - instantiate the DAO Factory
   - load the used plugins</p>
<pre><code> - load all plugins if used and installed
 - sort the plugins by priority
</code></pre>

<p> If any error happens during the initialization of the DAO or plugins,
 it return an nginx error and exit.







  </dd>
</dl>


    </div>
  </div>
</div>
</div>
